<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>01_异步函数-异步函数的写法</title>
</head>
<body>

  <script>
    // 1.普通函数
    function foo() {
      console.log('foo');
    }
    foo();

    // 2.普通函数 + 回调函数
    function foo1(callback) {
      setTimeout(() => {
        console.log('foo1');
        callback();
      }, 1000);
    }
    foo1(() => {
      console.log('foo1 callback');
    });

    // 3. 异步函数
    async function foo2() {
      console.log('foo2');
    }
    foo2();

    const bar = async () => {
      console.log('foo2');
    }
    bar();

    
  </script>
  
</body>
</html>